home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / fibonac.zip / FIBONAC.DOC < prev    next >
Text File  |  1993-01-04  |  3KB  |  158 lines

  1. **********************************************************************
  2. You should have the following files in the arc file :
  3.  
  4.  
  5.   Fibonac.pas - Fibonacci source.
  6.  
  7.   Fibonac.com - In case you do not have turbo pascal you can still
  8.                 work with the idea of Fibonacci sequence.
  9.  
  10.   Fibonac.doc - Fibonacci introduction.
  11. **********************************************************************
  12.  
  13.  
  14.      This  program  was  written to  turn  our  attention
  15. to  the  idea  of  fibonacci  sequences.  This  program  illustrates
  16. that  a  recursive  routine  may  call  itself  a  number  of  times
  17. with  different arguments.  In  fact,  as  long  as  a  recursive
  18. routine  uses  only  local  variables,  the  programmer  can  use
  19. the  routine  just  as  he  uses  any  other  and  assume  that  it
  20. performs  its  function  and  produces  the  desired  value.  You
  21. need  not  worry  about  the  underlying  stacking  mechanism.
  22.  
  23.  
  24. RECURSION stack operation for fibonacci function :
  25.  
  26.   N     X     Y     Pass
  27.  
  28.   6     *     *
  29. ----------------     1
  30.  
  31.   5     *     *
  32.   6     *     *
  33. ----------------     2
  34.  
  35.   4     *     *
  36.   5     *     *
  37.   6     *     *
  38. ----------------     3
  39.  
  40.   3     *     *
  41.   4     *     *
  42.   5     *     *
  43.   6     *     *
  44. ----------------     4
  45.  
  46.   2     *     *
  47.   3     *     *
  48.   4     *     *
  49.   5     *     *
  50.   6     *     *
  51. ----------------     5
  52.  
  53.   1     *     *
  54.   2     *     *
  55.   3     *     *
  56.   4     *     *
  57.   5     *     *
  58.   6     *     *
  59. ----------------     6
  60.  
  61.   2     1     *
  62.   3     *     *
  63.   4     *     *
  64.   5     *     *
  65.   6     *     *
  66. ----------------     7
  67.  
  68.   0     *     *
  69.   2     1     *
  70.   3     *     *
  71.   4     *     *
  72.   5     *     *
  73.   6     *     *
  74. ----------------     8
  75.  
  76.   0     *     *
  77.   2     1     *
  78.   3     *     *
  79.   4     *     *
  80.   5     *     *
  81.   6     *     *
  82. ----------------     9
  83.  
  84.   2     1     0
  85.   3     *     *
  86.   4     *     *
  87.   5     *     *
  88.   6     *     *
  89. ----------------     10
  90.  
  91.   3     1     *
  92.   4     *     *
  93.   5     *     *
  94.   6     *     *
  95. ----------------     11
  96.  
  97.   1     *     *
  98.   3     1     *
  99.   4     *     *
  100.   5     *     *
  101.   6     *     *
  102. ----------------     12
  103.  
  104.   3     1     1
  105.   4     *     *
  106.   5     *     *
  107.   6     *     *
  108. ----------------     13
  109.  
  110.   4     2     *
  111.   5     *     *
  112.   6     *     *
  113. ----------------     14
  114.  
  115.   2     *     *
  116.   4     2     *
  117.   5     *     *
  118.   6     *     *
  119. ----------------     15
  120.  
  121.   1     *     *
  122.   2     *     *
  123.   4     2     *
  124.   5     *     *
  125.   6     *     *
  126. ----------------     16
  127.  
  128.   0     *     *
  129.   2     1     *
  130.   4     2     *
  131.   5     *     *
  132.   6     *     *
  133. ----------------     17
  134.  
  135.   2     1     0
  136.   4     2     *
  137.   5     *     *
  138.   6     *     *
  139. ----------------     18
  140.  
  141.   4     2     1
  142.   5     *     *
  143.   6     *     *
  144. ----------------     19
  145.  
  146.   5     3     *
  147.   6     *     *
  148. ----------------     20
  149.  
  150.   3     *     *
  151.   5     3     *
  152.   6     *     *
  153. ----------------     21
  154.  
  155. The  rest  of  the  stack  operation  is  left  for  you
  156. to  finish  as an excercise.
  157.  
  158.